<template>
	<view class="real_name">
		<view class="conta-tit">法定代表人全业务授权</view>
		<!-- 管理员变更法人授权书 -->
		<view class="conta_del">
			<view class="item_con">
				<h3 style="text-align: left;font-size: 30rpx;color: #666666;">尊敬的{{companyCertification.legalPerson}}您好！</h3>
				<h4>请您代表如下企业签署《法定代表人全业务授权书》，完成企业电子签约账户全业务授权。如您不是该企业法定代表人，请忽略本信息。</h4>
				<p class="border_top" style="margin-top:30rpx">组织机构名称：{{ companyCertification.companyName }}</p>
				<p class="border_top">社会信用代码：{{ companyCertification.regNum }}</p>
				<p class="border_top">法定代表人：{{ companyCertification.legalPerson }}</p>
				<p class="border_top" style="padding: 0;">身份证件号码：{{ companyCertification.legalPersonIdNumber}}</p>
				<p class="border_center">今授权代理人：{{ staff.name }}
					<i class="iconfont" style="font-size: 28rpx;padding: 0 4rpx;" v-if="staff.isCertify==1">&#xe625;</i>
					<i class="iconfont" style="font-size: 28rpx;padding: 0 4rpx;" v-if="staff.isCertify!=1">(未认证)</i>
					{{staff.mobile}}
					<span style="padding:6rpx 10rpx 6rpx;">为励氪签电子签约平台企业账户管理员，代表本单位经办如下事项：</span>
				</p>
				<p class="border-bo" style="margin-top:10rpx">1、代表本单位申请励氪签电子签约账户并进行单位实名认证；</p>
				<p class="border-bo">2、代表本单位申请各类印章，包含法定代表人私章或单位负责人私章；</p>
				<p class="border-bo">3、代表本单位使用各类印章及代理人个人签字章签署本单位各类文件或合同；</p>
				<p class="border-bo">4、代表本单位全权管理电子签约企业账户的所有操作，行使上述各类印章的管理及再授权业务；</p>
				<p class="border-bo">5、代表本单位授权员工使用各类印章及员工个人签字章，签署本单位各类业务文件或合同。</p>
			</view>
		</view>

		<!-- 底部按钮 -->
		<view class="footer-btn">
      <checkbox-group @change="selectFa" style="margin:0rpx 0 25rpx;">
        <label>
          <checkbox value="face" color="#00a660" style="transform:scale(0.6)"/>
          <span style="font-size: 26rpx;">我同意励氪签采集人脸照片用于实名认证</span>
        </label>
      </checkbox-group>
			<button @click="nextAgree">登录并签署</button>
		</view>

	</view>
</template>

<script>
	import {
		genLegalCert,
		getInfoByCompanyId
	} from "../../../api/companyCertification";
	import {
		getStaff
	} from "../../../api/staff";
  import {
    getToken, removeToken
  } from "../../../utils/auth";

	export default {
		data() {
			return {
        // 人脸认证选择
        confirmFace: '',
				companyId: 0, //当前公司id
				companyCertification: {}, // 认证信息
				staff: {}, //授权人信息
				id: 0, //合同id
				flowId: 0, //合同流程id
			}
		},
    onLoad() {
      // 公司id
      let data = JSON.parse(Buffer.from(this.$mp.query.data, 'base64').toString('binary'));
      this.companyId = data.companyId;
      this.contractId = data.contractId;
      this.flowId = data.contractFlowId;
      this.adminNewId = data.adminNewId;
      this.getCertInfoByCompanyId();
    },
		methods: {
      /** 人脸照片用于实名认证选择 */
      selectFa(e) {
        this.confirmFace = e.detail.value[0]
      },
			getCertInfoByCompanyId() {
        // 查询法人信息
				getInfoByCompanyId(this.companyId).then(response => {
					this.companyCertification = response.data;
				});
        // 授权人
        getStaff(this.adminNewId).then(response => {
          this.staff = response.data;
        })
			},
			/** 登录并签署《法定代表人全业务授权书》 */
			nextAgree() {
        if (this.confirmFace != 'face') {
          this.$modal.msgError("请勾选协议")
          return;
        }
        this.$modal.msg("加载中，请稍候...")
        removeToken();
        let param = new Buffer("id=" + this.contractId + "&flowId=" + this.flowId).toString('base64');
        this.$tab.reLaunch('/pages/signWeb/loginWeb?share=' + param);
			},
		},
	}
</script>

<style lang="scss" scoped>
	page {
		background: $uni-bg-color;
	}

	.conta-tit {
		font-size: 32rpx;
		color: #fff;
		width: 100%;
		height: 100rpx;
		background: $uni-color-primary;
		line-height: 100rpx;
	}

	.item_con {
		text-align: center;
		margin: 0 auto;
		width: 90%;
	}

	.real_name {
		padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
		padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
		text-align: center;
		width: 100%;

		// 底部按钮
		.footer-btn {
			width: 95%;
			margin: 100rpx auto 50rpx;

			button {
				background-color: $uni-color-primary;
				color: #fff;
				font-size: 32rpx;
			}
		}

		// 协议内容
		.conta_del {
			width: 100%;
			background: #fff;
			margin-top: 60rpx;

			h4 {
				color: #535252;
				text-align: left;
				text-indent: 2em;
				margin-top: 20rpx;
				padding-bottom: 40rpx;
				border-bottom: 1rpx solid #d9d9d9;
			}

			.border_top {
				text-align: left;
				margin: 0;
				padding: 14rpx 0;
				font-size: 26rpx;
				color: #535252;
				display: flex;
				align-items: center;
			}

			.border_center {
				text-align: left;
				font-size: 28rpx;
				color: $uni-color-primary;
				margin: 16rpx 0 12rpx;
				padding: 6rpx 0;
			}

			.border-bo {
				color: #535252;
				text-align: left;
				margin: 0;
				padding: 4rpx 6rpx;
				font-size: 28rpx;
			}
		}
	}
</style>
